package com.klun.spring4.b_four.four3;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.util.FileCopyUtils;

import java.io.IOException;

public class EncodedResourceExample {
    public static void main(String[] args) throws IOException {
        Resource res = new ClassPathResource("test/file1.txt");
        EncodedResource encRes = new EncodedResource(res, "UTF-8");
        String s = FileCopyUtils.copyToString(encRes.getReader());
        System.out.println(s);
    }

}
